/*
 * lib2Desa - Another 2D game library in C++
 * Copyright (C) 2009 Erivaldo Xavier de Lima Filho
 *
 * This program is free software and is distributed under GNU General Public License version 3. You can modify and/or redistribute
 * it under the terms of GPL version 3 or posterior version. This program comes with NO WARRANTY, for more details, see LICENSE,
 * or <http://www.gnu.org/licenses>.
 *
 * Contact info:
 *
 *	Erivaldo Xavier de Lima Filho, desadoc@gmail.com
 *
 */

#ifndef _EVENT_HPP
#define _EVENT_HPP

#include "Core/shared_ptr.hpp"
#include "Core/IEvent.hpp"
#include "Core/GameElement.hpp"

#ifndef _NO_NAMESPACE
namespace lib2Desa {
#endif

template <class M>
class Event : public IEvent
{
private:

	const M msg;
	const weak_ptr<GameObject> source;
	const weak_ptr<GameObject> target;

public:

	Event(const weak_ptr<GameObject>& src, const weak_ptr<GameObject>& tgt, const M& m)
	: msg(m), source(src), target(tgt)
	{

	}

	EVENT_TYPE getType(void) const
	{
		return msg.getEventType();
	}

	const M& getMessage(void) const
	{
		return msg;
	}

	const weak_ptr<GameObject>& getSource(void) const
	{
		return source;
	}

	const weak_ptr<GameObject>& getTarget(void) const
	{
		return target;
	}
};

#ifndef _NO_NAMESPACE
}
#endif

#endif /*Event.hpp included*/
